const express = require('express')
const router = express.Router()
const auth = require('@/middleware/auth.middleware')
const commentController = require('@/controllers/comment.controller')

/**
 * 文章评论列表分页查询
 * @route GET /comment/article
 * @summary 文章评论列表分页查询
 * @group 评论管理
 * @param {string} pageNo.query.required
 * @param {string} pageSize.query.required
 * @param {string} searchKeywords.query 搜索关键字
 * @returns {object} 200
 * @returns {Error}  default - Unexpected error
 * @access article-comment-permission:btn:find
 * @security JWT
 */
router.get('/article', auth(), commentController.findArticleComments)

/**
 * 友圈评论列表分页查询
 * @route GET /comment/circle
 * @summary 友圈评论列表分页查询
 * @group 评论管理
 * @param {string} pageNo.query.required
 * @param {string} pageSize.query.required
 * @param {string} searchKeywords.query 搜索关键字
 * @returns {object} 200
 * @returns {Error}  default - Unexpected error
 * @access circle-comment-permission:btn:find
 * @security JWT
 */
router.get('/circle', auth(), commentController.findCircleComments)

/**
 * 文章评论删除
 * @route DELETE /comment/article
 * @summary 文章评论删除
 * @group 评论管理
 * @param {string} id.query.required
 * @returns {object} 200
 * @returns {Error}  default - Unexpected error
 * @access article-comment-permission:btn:delete
 * @security JWT
 */
router.delete('/article', auth(), commentController.deleteArticleComment)

/**
 * 友圈评论删除
 * @route DELETE /comment/circle
 * @summary 友圈评论删除
 * @group 评论管理
 * @param {string} id.query.required
 * @returns {object} 200
 * @returns {Error}  default - Unexpected error
 * @access circle-comment-permission:btn:delete
 * @security JWT
 */
router.delete('/circle', auth(), commentController.deleteCircleComment)

module.exports = router
